package me.sdevil507.services.dto;

import lombok.Data;

import java.util.List;
import java.util.Objects;

/**
 * @program: tips_back_end
 * @description: 消费端 雷达图
 **/
@Data
public class RadarResultDTO {

    public String shortName;

    public String typeName;

    public String typeValue;

    public Integer count;

    public List<Integer> numList;
    
    public Integer sumCount;

    public RadarResultDTO() {
    }

    public RadarResultDTO(String shortName, String typeName, String typeValue, Long count) {
        this.shortName = shortName;
        this.typeName = typeName;
        this.typeValue = typeValue;
        this.count = count.intValue();
    }

    public RadarResultDTO(String shortName, List<Integer> numList) {
        this.shortName = shortName;
        this.numList = numList;
        this.sumCount = numList.stream().filter(Objects::nonNull).reduce(Integer::sum).orElse(0);;
    }
}
